package com.fin.zw.intelligentbot.entity;

import com.fin.zw.intelligentbot.enums.SourceType;
import com.fin.zw.intelligentbot.enums.VoiceType;
import lombok.Data;
import org.hibernate.annotations.Table;

import javax.persistence.*;
import java.util.Set;

@Entity
@Table(appliesTo = "ai_configuration",comment = "人工智能语音配置")
@Data
public class AiConfiguration extends BaseEntity {

    @Column(columnDefinition = "varchar(100) COMMENT '名称'")
    private String name;

    @Column(columnDefinition = "varchar(100) COMMENT '制造商'")
    private String mader;

    @Column(columnDefinition = "varchar(100) COMMENT '使用具体语音实体'")
    private String code;

    @Column(columnDefinition = "varchar(100) COMMENT '类型'")
    @Enumerated(EnumType.STRING)
    private VoiceType type;

    @Column(columnDefinition = "varchar(20) COMMENT '来源'")
    @Enumerated(EnumType.STRING)
    private SourceType source;

    @OneToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "account_id",columnDefinition = "varchar(64) COMMENT 'ai账号信息'")
    private AiAccount accounts;

    @Column(columnDefinition = "text COMMENT '配置参数json'")
    private String param;

    @ManyToMany(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY)
    @JoinTable(name = "config_company", joinColumns = @JoinColumn(name = "config_id"), inverseJoinColumns = @JoinColumn(name = "company_id"))
    private Set<Company> companies;
}
